 <#include "/admin/common/include/html_head.html"> <#include
"/admin/common/include/sysparam.html">

<style>
#editable {
	padding: 10px;
	float: left;
}
</style>

<div class="row-fluid">
	<div class="span12">
		<!-- BEGIN EXTRAS PORTLET-->
		<div class="portlet box">
			<div class="portlet-title">
				<div class="caption">
					<h5>主题编辑</h5>
				</div>
			</div>
			<div class="portlet-body form">
				<div class="alert alert-error " id="errtip" style="display: none;"></div>
				<!-- BEGIN FORM-->
				<form action="${contextPath}/templatepackage/save.op"
					id="templateAddForm" class="form-horizontal" method="post"
					onSubmit="return false;">
					<input type="hidden" name="id" value="${(bean.id)?if_exists}" /> <input
						type="hidden" name="templateType" value="0" /> <input
						type="hidden" name="templatePackageId"
						value="${(bean.templatePackageId)?if_exists}" /> <input
						type="hidden" name="templatePackageId" value="0" />

					<div class="control-group">
						<label class="control-label">主题名称</label>
						<div class="controls">
							<input class="span2 m-wrap" name="name" require="true"
								datatype="require|limit" type="text" min="1" max="100"
								msg="主题名称不能为空|长度不能超过100" value="${(bean.name)?if_exists}" />
						</div>
					</div>
					<div class="control-group">
						<label class="control-label">访问路径</label>
						<div class="controls">
							<input class="span2 m-wrap" name="prjUrl" require="true"
								datatype="require|limit" type="text" min="1" max="100"
								msg="访问路径不能为空|长度不能超过100" value="${(bean.prjUrl)?if_exists}" />
						</div>
					</div>
					
					<div class="control-group">
						<label class="control-label">主题图片</label>
						<div class="controls">
								<#if bean?? && bean.imageUrl ?? > <img
									src="${contextPath}${(bean.imageUrl)?if_exists}"  width="120"
								height="120" id="imgShow" alt="Photo" /> <#else> <img
									src="${contextPath}/common/image/default-pic.png"  width="120"
								height="120" id="imgShow" /> </#if>  
							 
						</div>
					</div>
					<div class="control-group">
						<label class="control-label"></label>
						<div class="controls">
							<span class="btn  fileinput-button"> <i
								class="icon-plus icon-white"></i> <span>选择文件...</span> <input
								type="file" id="upfile1" name="upfile1" />
							</span> <input type="hidden" id="imageUrl" name="imageUrl"
								value="${(bean.imageUrl)?if_exists}" /> <a class="btn start"
								onclick="uploadNavPic();"> <i class="icon-upload icon-white"></i>
								<span>上传</span>
							</a> <br> <span class="alert alert-error" id="upfile1_error_tip"
								style="display: none;"></span>
							<div class="alert alert-success" id="upfile1_detail"
								style="display: none;">
								<div class="fileName">
									文件名称:<span></span>
								</div>
								<div class="fileSize">
									文件大小:<span></span>
								</div>
							</div>

						</div>
					</div>
					<div class="control-group">
						<label class="control-label">是否有效</label>
						<div class="controls"><@select2 paramCode=iseffCode
							value=(bean.iseff)?if_exists item=' require="true" name="iseff"
							datatype="require" msg="是否有效不能为空"'/></div>
					</div>
					<div class="form-actions">
						<button type="button" id="template_save_btn" class="btn blue">保存</button>
						<button type="button" id="template_return_btn" class="btn ">返回</button>

					</div>
				</form>
				<!-- END FORM-->
			</div>
		</div>
		<!-- END EXTRAS PORTLET-->
	</div>
</div>

<script>
	function uploadNavPic() {
		ajax.upload({
			fileEleId : 'upfile1',
			filePathId : 'imageUrl',
			successFn : function(data) {
				var isImg = /\.(gif|jpg|jpeg|png|GIF|JPG|PNG)$/
						.test(data.result.webfilePath);
				if (isImg)
					$('#imgShow').attr("src", data.result.webfilePath);
			}
		});
	}

	$(document).ready(function() {
		tableAction.initSaveAction({
			formId : 'templateAddForm',
			queryUrl : '${contextPath}/templatepackage/show.op',
			saveUrl : '${contextPath}/templatepackage/save.op',
			saveBtnId : 'template_save_btn'
		});

		$("#template_return_btn").bind("click", function() {
			var url = '${contextPath}/templatepackage/show.op';
			mainFrame.addContainer(url);
		});
	});
</script>
<#include "/admin/common/include/html_bottom.html">
